#include "qtreeviewdemo.h"
#include <QTreeView>
#include <QFileDialog>
#include <QFileSystemModel>

#include <QVBoxLayout>
QTreeViewDemo::QTreeViewDemo(QWidget *parent) :
    BaseWidget(parent)
{    
    QFileSystemModel *model = new QFileSystemModel;
    model->setRootPath(QDir::currentPath());
    QTreeView *tree = new QTreeView;
    tree->setModel(model);
    tree->setAnimated(false);  //动画？
    tree->setIndentation(20);  //缩进
    tree->setSortingEnabled(true);

    QVBoxLayout* mainLayout=new QVBoxLayout;
    mainLayout->addWidget(tree);
    setLayout(mainLayout);
}
